import Vue from 'vue';
import FaultLibraryDetail from './views/FaultLibraryDetail.vue';
import i18n from '@src/locales';

/* util */
import qs from '@src/util/querystring'

// 处理注入的参数
let initData = {};

try {
  initData = JSON.parse(sessionStorage.getItem('_init_data') || '{}') || {};
} catch (error) {
  console.error(error);
  console.error('no init data')
}

let query = qs.parse(window.location.search.substr(1));
const id = window.location.pathname.split('/faultLibrary/detail/')[1];
const params = Object.assign({}, query, {id})
const FaultLibraryViewComp = Vue.extend(FaultLibraryDetail);
const app = new FaultLibraryViewComp({
  i18n,
  propsData: { initData, query: params}
});

app.$mount('#app');

export default app;